<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
    <script type="text/javascript" src="scripts/jquery.js"></script>
    <style type="text/css">
        iframe{
            width: 100%;
            height:auto;
            min-height: 200px;
            border: none;
        }
    </style>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function(){
        resetIframeHeight();
    });
    function resetIframeHeight(){
        $(window.frames["ifBaidu"].document).ready(function(){
            parent.$('#ifBaidu').height($('body').height());
        })
    }
    function search(){
        var ifBaidu=window.frames["ifBaidu"];
        alert(ifBaidu)
        $(window.frames["ifBaidu"]).find('#kw').val($('#text').val());
        $(window.frames["ifBaidu"].document).find('#su').trigger('click');
    }
</script>
<input type="text" id="text">
<button onclick="search()">搜索</button>
<iframe id="ifBaidu" name="ifBaidu" src="http://www.baidu.com"></iframe>
</body>
</html>
